<?php

/**
 * EntryVersion form base class.
 *
 * @method EntryVersion getObject() Returns the current form's model object
 *
 * @package    berta-s
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEntryVersionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'expando_fields' => new sfWidgetFormInputText(),
      'name'           => new sfWidgetFormInputText(),
      'content'        => new sfWidgetFormTextarea(),
      'section_id'     => new sfWidgetFormInputText(),
      'published'      => new sfWidgetFormInputCheckbox(),
      'datetime'       => new sfWidgetFormDateTime(),
      'slug'           => new sfWidgetFormInputText(),
      'position'       => new sfWidgetFormInputText(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
      'version'        => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'expando_fields' => new sfValidatorPass(array('required' => false)),
      'name'           => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'content'        => new sfValidatorString(array('required' => false)),
      'section_id'     => new sfValidatorInteger(array('required' => false)),
      'published'      => new sfValidatorBoolean(array('required' => false)),
      'datetime'       => new sfValidatorDateTime(array('required' => false)),
      'slug'           => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'position'       => new sfValidatorInteger(array('required' => false)),
      'created_at'     => new sfValidatorDateTime(),
      'updated_at'     => new sfValidatorDateTime(),
      'version'        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('version')), 'empty_value' => $this->getObject()->get('version'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('entry_version[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EntryVersion';
  }

}
